<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfheader name="Expires" value="#Now()#" />
	<title><cfoutput>#KalendarRequest.getKalendarConfig().getAppTitle() & "    " & KalendarRequest.getAppAction()#</cfoutput></title>
	<link href="<cfoutput>#KalendarRequest.getKalendarConfig().getCSSPath()#kalendar_#session.user.getRoleCode()#</cfoutput>.css" rel="stylesheet" type="text/css" />
	<link href="<cfoutput>#KalendarRequest.getKalendarConfig().getAdminCSSPath()#</cfoutput>main.css" rel="stylesheet" type="text/css" />
	<link href="<cfoutput>#KalendarRequest.getKalendarConfig().getCSSPath()#tabber_#session.user.getRoleCode()#</cfoutput>.css" rel="stylesheet" type="text/css" />

<cfif listFindNoCase("addCategory,editCategory", KalendarRequest.getAppAction() ) >
	<link href="<cfoutput>#KalendarRequest.getKalendarConfig().getAdminCSSPath()#</cfoutput>categories.css" rel="stylesheet" type="text/css" />

	<script type="text/javascript">
		
		//<![CDATA[

		var theElement = "";
		
		function colorPicker_callBack(strColor) {
			document.getElementById(theElement).value = strColor;
			changeBGColor();
			changeTextColor();
		}
		
		function openColorPickerAdv() {
			document.getElementById('colorPickerAdvDiv').style.visibility = 'visible';
		}
		
		function handleFocus(e) {
			theElement = e;
		}
		
		function closeColorPickerAdv() {
			document.getElementById('colorPickerAdvDiv').style.visibility = 'hidden';
		}
		
		function changeBGColor() {
			if(document.getElementById('CategoryBGColor').value.length) {
				document.getElementById('colorswatch').style.backgroundColor = "#" + document.getElementById('CategoryBGColor').value;
			}
		}
		
		function changeTextColor() {
			if(document.getElementById('CategoryTextColor').value.length) {
				document.getElementById('colorswatch').style.color = "#" + document.getElementById('CategoryTextColor').value;
			}
		}

		function getCategory() {
			var CategoryID = document.getElementById('categoriesForm').CategoryIDSelector.options[document.getElementById('categoriesForm').CategoryIDSelector.selectedIndex].value;
			document.location.href="index.cfm?appAction=editCategory&CategoryID=" + CategoryID;
		}
		<cfif KalendarRequest.getAppAction() IS "editCategory">
			
		function cancelEdit() {
			document.location.href="index.cfm?appAction=addCategory";
		}
			
		function deleteCategory() {
			var CategoryID = document.getElementById('categoriesForm').CategoryID.value;
			var agree=confirm("This record will be deleted. Would you like to continue? IT CANNOT BE UNDONE!");
			if(agree) {
				document.location.href="process_category.cfm?appAction=deleteCategory&CategoryID=" + CategoryID;
			}
		}
		</cfif>//]]>
	</script>
</cfif>


<cfif KalendarRequest.getAppAction() IS "displayImportData" >
	<script language="javascript" type="text/javascript">
		//<![CDATA[
		var lastState = false;
		function selectAll(val) {
			with(document.dataImportForm) {
				var d;
				d=document.getElementsByTagName("input");
				for(i=0;i<d.length;i++) {
					if(d[i].type=="checkbox") {
	     				d[i].checked=val;
					}
				}
			}        
		}
	    function toggleList() {
	        lastState == false ? selectAll(true) : selectAll(false);
	        lastState = lastState == true ? false: true;
	    }
	    //]]>
	</script>
</cfif>
<cfif listFindNoCase( "addRecord,editRecord", KalendarRequest.getAppAction()) >
	<!-- calendar stylesheet -->
	<link rel="stylesheet" type="text/css" media="all" href="<cfoutput>#KalendarConfig.getJavascriptPath()#</cfoutput>jscalendar-1.0/calendar-win2k-cold-1.css" title="win2k-cold-1" />
	<!-- main calendar program -->
	<script type="text/javascript" src="<cfoutput>#KalendarConfig.getJavascriptPath()#</cfoutput>jscalendar-1.0/calendar.js"></script>
	<!-- language for the calendar -->
	<script type="text/javascript" src="<cfoutput>#KalendarConfig.getJavascriptPath()#</cfoutput>jscalendar-1.0/lang/calendar-en.js"></script>
	<!-- the following script defines the Calendar.setup helper function, which makes
	       adding a calendar a matter of 1 or 2 lines of code. -->
	<script type="text/javascript" src="<cfoutput>#KalendarConfig.getJavascriptPath()#</cfoutput>jscalendar-1.0/calendar-setup.js"></script>
	<script type="text/javascript" src="<cfoutput>#KalendarConfig.getJavascriptPath()#</cfoutput>tabber/tabber.js"></script>
	<script type="text/javascript">
		//<![CDATA[
		function checkIt() {
			/* if (typeof FCKeditorAPI !== "undefined") {
				var oEditor = FCKeditorAPI.GetInstance('Description');
					oEditor.UpdateLinkedField();
			}
			if(!document.eventForm.Description.value) {
				alert('Body is a required field');
				return false;
			} */
			if(Date.parse(document.eventForm.StartDate.value) > Date.parse(document.eventForm.EndDate.value)) {
				alert('Start Date must be the same as or before the end date');
				return false;	
			}
			if (document.getElementById('IsAllDayEvent').checked == false) {
				if (document.getElementById('StartTime').value.length == 0) {
					alert('Start Time is required for an event that is not marked as being all day.');
					return false;
				}
			}
		}
		//]]>
	</script>
</cfif>
<cfif KalendarRequest.getAppAction()  IS "editRecord">
<script type="text/javascript">
	//<![CDATA[
	function removeRecord() {
	var agree=confirm("This record will be deleted. Would you like to continue?")
		if (agree)
		window.location.href = "process_event.cfm?appAction=deleteRecord&fromPublic=true&EventID=<cfoutput>#KalendarEvent.getEventID()#</cfoutput>";	
	}
//]]>
</script>
</cfif>
<cfif ListFindNoCase('addRecord,EditRecord',KalendarRequest.getAppAction())>
<script type="text/javascript">
	//<![CDATA[
	function toggleTimes() {
		var allDay = document.getElementById('IsAllDayEvent');
		var startTime = document.getElementById('StartTime');
		var endTime = document.getElementById('EndTime'); 
		if (allDay.checked) {
			startTime.value = "";
			startTime.disabled = "disabled";
			endTime.value = "";
			endTime.disabled = "disabled";
		} else {
			startTime.disabled = "";
			endTime.disabled = "";
		}
	}
	document.write('<style type="text/css">.tabber{display:none;}<\/style>');
//]]>
</script>
</cfif>
</head>
<body <cfif listFindNoCase("addCategory,editCategory", KalendarRequest.getAppAction()) > onload="changeBGColor();changeTextColor();"</cfif>>
<!--- <cfif NOT URL.fromPublic>
<div>
	<!--- <a href="index.cfm?appAction=displayCalendar">Edit</a>
	&middot; --->
	<a href="index.cfm?appAction=addRecord">add event</a>
	&middot;
	<cfif session.user.getRole() GTE 3>
		<a href="index.cfm?appAction=addCategory">category manager</a>
		&middot;
	</cfif>
	<a href="index.cfm?appAction=displayImportForms">import events</a>
	&middot;
	<a href="<cfoutput>#KalendarConfig.getKalendarURLPath()#</cfoutput>">back to kalendar</a>
	<p />
	<div align="left" style="width:650px;"><!-- End Header -->
</cfif> --->